	$(function() {	 //首页展示默认数据加载
		//banner图片轮换
		//readIndexBanner();
		//行业方案
		//readIndexIndustry();
		//产品轮换
		//readIndexCplh();
		//经典案例
		//readIndexJdal();
		//资讯中心
		//readIndexZxzx();
	});

	var baseUrl = "";
	
	//banner图片轮换
	function readIndexBanner(){
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url:baseUrl+'/selectBannerListr',
			contentType:'application/json;charset=UTF-8',
			success: function (result) {
				if(result!=null){
					var str1 = "";
					var str2 = "";
					for(var i=0;i<result.length;i++){
						if(i==0){
							str1+="<li data-target=\"#carousel-example-generic\" data-slide-to=\""+i+"\" class=\"active\"></li>";
							str2+="<div class=\"item active\">";
						}else{
							str1+="<li data-target=\"#carousel-example-generic\" data-slide-to=\""+i+"\"></li>";
							str2+="<div class=\"item\">";
						}
						str2+="<a href=\"#\" class=\"pc_imgBox\"><img src=\""+result[i].imgurl+"\" alt=\"\"></a>"; 
						str2+="</div>";
						}
					$("#index_banner_ol").html(str1);
					$("#index_banner_div").html(str2);
					}else{
						$("#index_banner").html("暂无数据");
				}
			},
			error: function (result) {
			}
		});
	}
	
	//行业方案
	function readIndexIndustry(){
		//行业方案标题加载
		readIndexIndustryTitle();
		//行业方案图片加载
		readIndexIndustryImg();
	}

	function readIndexIndustryTitle(){
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url:baseUrl+'/selectIndustryListr',
			async: false,
			contentType:'application/json;charset=UTF-8',
			success: function (result) {
				if(result!=null){
					result.splice(5, 2);  //从第5个下标开始，删除两行
					//行业方案标题赋值
					$("#index_industr_name1").text(result[0].name);
					$("#index_industr_name1").attr("data_id",result[0].id);
					$("#index_industr_remarks1").text(result[0].remarks);
					
					$("#index_industr_name2").text(result[1].name);
					$("#index_industr_name2").attr("data_id",result[1].id);
					$("#index_industr_remarks2").text(result[1].remarks);
					
					$("#index_industr_name3").text(result[2].name);
					$("#index_industr_name3").attr("data_id",result[2].id);
					$("#index_industr_remarks3").text(result[2].remarks);
					
					$("#index_industr_name4").text(result[3].name);
					$("#index_industr_name4").attr("data_id",result[3].id);
					$("#index_industr_remarks4").text(result[3].remarks);
					
					$("#index_industr_name5").text(result[4].name);
					$("#index_industr_name5").attr("data_id",result[4].id);
					$("#index_industr_remarks5").text(result[4].remarks);
					
					$("#index_industr_name6").text(result[5].name);
					$("#index_industr_name6").attr("data_id",result[5].id);
					$("#index_industr_remarks6").text(result[5].remarks);
					
					$("#index_industr_name7").text(result[6].name);
					$("#index_industr_name7").attr("data_id",result[6].id);
					$("#index_industr_remarks7").text(result[6].remarks);
				}else{
					$("#index_industr_title_hdzl").text("暂无数据");
					$("#index_industr_title_hdly").text("暂无数据");
					$("#index_industr_title_hdcy").text("暂无数据");
				}
			},
			error: function (result) {
			}
		});
	}
	
	//行业方案图片加载
	function readIndexIndustryImg(){
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url:baseUrl+'/selectndexshowListrById',
			contentType:'application/json;charset=UTF-8',
			success: function (result) {
				if(result!=null){
					var array1 = new Array();
					var dataid1 = $("#index_industr_name1").attr("data_id");
					var array2 = new Array();
					var dataid2 = $("#index_industr_name2").attr("data_id");
					var array3 = new Array();
					var dataid3 = $("#index_industr_name3").attr("data_id");
					var array4 = new Array();
					var dataid4 = $("#index_industr_name4").attr("data_id");
					var array5 = new Array();
					var dataid5 = $("#index_industr_name5").attr("data_id");
					var array6 = new Array();
					var dataid6 = $("#index_industr_name6").attr("data_id");
					var array7 = new Array();
					var dataid7 = $("#index_industr_name7").attr("data_id");
					for(var i=0;i<result.length;i++){
						if(result[i].industryId==dataid1){
							array1.push(result[i]);
						}else if(result[i].industryId==dataid2){
							array2.push(result[i]);
						}else if(result[i].industryId==dataid3){
							array3.push(result[i]);
						}else if(result[i].industryId==dataid4){
							array4.push(result[i]);
						}else if(result[i].industryId==dataid5){
							array5.push(result[i]);
						}else if(result[i].industryId==dataid6){
							array6.push(result[i]);
						}else if(result[i].industryId==dataid7){
							array7.push(result[i]);
						}
					}
					//主题公园
					readImagesHdly(array1);
					//互动展览馆
					readImagesHdzlg(array2);
					//多媒体汇演
					readImagesDmthy(array3);
					//互动多媒体
					readImagesHddmt(array4);
					//儿童乐园
					readImagesEtly(array5);
					//互动餐饮
					readImagesHdcy(array6);
					//主题活动
					readImagesZthd(array7);
				}
			},
			error: function (result) {
			}
		});
	}
	
	//主题公园拼接
	function readImagesHdly(data){
		 var str="";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		$("#index_industr_content1").html(str);
	}
	
	
	
	//互动展览馆拼接
	function readImagesHdzlg(data){
		 var str="";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 
		 //版式注解
		 /*str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[3].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";*/
		$("#index_industr_content2").html(str);
	}
	
	//多媒体汇演拼接
	function readImagesDmthy(data){
		 var str="";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		$("#index_industr_content3").html(str);
	}
	
	
	//互动多媒体拼接
	function readImagesHddmt(data){
		 var str="";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-4\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-4\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-4\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[3].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		$("#index_industr_content4").html(str);
	}
	
	
	//儿童乐园拼接
	function readImagesEtly(data){
		 var str="";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[3].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		$("#index_industr_content5").html(str);
	}
	
	//互动餐饮拼接
	function readImagesHdcy(data){
		 var str="";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-6\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		$("#index_industr_content6").html(str);
	}
	
	
	//主题活动拼接
	function readImagesZthd(data){
		 var str="";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[0].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col-md-6\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_md\">";
		 str+="<img src=\""+data[1].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="<div class=\"col col-xs-12\">";
		 str+="<div class=\"blog-grids\">";
		 str+="<div class=\"col-md-12\">";
		 str+="<div class=\"col\">";
		 str+="<div class=\"tit_map\">";
		 str+="<img src=\""+data[2].imgurl+"\" alt=\"\">";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		 str+="</div>";
		$("#index_industr_content7").html(str);
	}
	
	

	

	
	//产品轮换
	function readIndexCplh(){
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url:baseUrl+'/selecProductListr',
			async: false,
			contentType:'application/json;charset=UTF-8',
			success: function (result) {
				if(result!=null){
					var str = "";
					for(var i=0;i<result.length;i++){
						str+="<div class=\"post-slide index_cplh\" data_id=\""+result[i].id+"\">";
						str+="<div class=\"post-img\">";
						str+="<a href=\"#\"><img src=\""+result[i].imgurl+"\" alt=\""+result[i].name+"\"></a>";
						str+="</div>";
						str+="<div class=\"post-content\">";
						str+="<h3 class=\"post-title\"><a href=\"#\">"+result[i].name+"</a></h3>";
						str+="</div>";
						str+="</div>";
					}
					$("#news-slider").html(str);
				}else{
					$("#news-slider").html("暂无数据");
				}
			},
			error: function (result) {
			}
		});
	}
	
	//经典案例
	function readIndexJdal(){
		//经典案例根据标题加载内容
		readIndexJdalContent();
	}
	
	
	function readIndexJdalContent(){
		readIndexJdalContentById();
	}
	
	function readIndexJdalContentById(){
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url:baseUrl+'/selecCaseListr',
			data: {
				id: 0
			},
			success: function (result) {
				if(result!=null){
					var str="";
					for(var i=0;i<result.length;i++){
						str+="<li class=\"span220\"  data_id=\""+result[i].id+"\">";
						str+="<a>";
						str+="<img src=\""+result[i].imgurl+"\" alt=\""+result[i].name+"\">";
						str+="</a>";
						str+="</li>";
					}
					$("#index_jdal").html(str);
				}else{
					$("#index_jdal").html("暂无数据");
				}
			},
			error: function (result) {
			}
		});
	}
	
	//资讯中心数据加载
	function readIndexZxzx(){
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url:baseUrl+'/selectInformationListr',
			contentType:'application/json;charset=UTF-8',
			success: function (result) {
				if(result!=null){
					var str = "";
					var base = new Base64();
					for(var i=0;i<result.length;i++){
						str+="<li class=\"span110\" data_id=\""+result[i].id+"\">";
						str+="<a title=\""+result[i].name+"\">";
						str+="<div class=\"news_img\">";
						str+="<img src=\""+result[i].imgurl+"\" alt=\""+result[i].name+"\">";
						str+="</div>";
						str+="<h2>"+result[i].name+"</h2>";
						str+="</a>";
						str+="<span>";
						str+=" <i></i>";
						str+=""+dataStringSub(result[i].update)+"&nbsp;&nbsp;&nbsp;&nbsp;来源：";
						str+="<a style=\"display: inline;\" href=\"#\">"+result[i].editors+"</a>";
						str+="</span>";
						str+="<p>"+analysisContent(base.decode(result[i].content))+"</p>";
						str+="</li>";
					}
					$("#index_zxzx").html(str);
				}else{
					$("#index_zxzx").html("暂无数据");
				}
			},
			error: function (result) {
			}
		});
	}
	
	//日期字符串截取
	function dataStringSub(str){
		if(str.length>11){		//判断字段如果过长截取字段长度返回展示
			str = str.substring(0,10);
		}
		return str;
	}
	
	//经典案例点击切换类型事情
	$(".subhead-title").on("click",function(){
		var typeId = $(this).attr("id");
		readIndexJdalContentById(typeId,"index_jdal_text");
  });
	
	
	//解析base64加密后的html文本并且判断长度大于多少进行截取
	function analysisContent(str){
		str = str.replace(/(\n)/g, "").replace(/(\t)/g, "").replace(/(\r)/g, "").replace(/<\/?[^>]*>/g, "").replace(/\s*/g, "").replace(/&nbsp;/ig, "");   //替换html基本标签
		if(str.length>40){		//判断字段如果过长截取字段长度返回展示
			str = str.substring(0,40)+"..."
		}
		return str;
	}
	
	
	//主题公园
	$(document).on("click","#index_industr_content1",function(e){
		window.location.href=baseUrl+"/ztgy";
	});
	
	//互动展览馆
	$(document).on("click","#index_industr_content2",function(e){
		window.location.href=baseUrl+"/hdzlg";
	});
	
	//多媒体汇演
	$(document).on("click","#index_industr_content3",function(e){
		window.location.href=baseUrl+"/dmthy";
	});
	
	//互动多媒体
	$(document).on("click","#index_industr_content4",function(e){
		window.location.href=baseUrl+"/hddmt";
	});
	
	//互动乐园
	$(document).on("click","#index_industr_content5",function(e){
		window.location.href=baseUrl+"/etly";
	});
	
	//互动餐饮
	$(document).on("click","#index_industr_content6",function(e){
		window.location.href=baseUrl+"/hdcy";
	});
	
	//主题活动
	$(document).on("click","#index_industr_content7",function(e){
		window.location.href=baseUrl+"/zthd";
	});
	
	
//	//产品跳转到产品详情
//	$(document).on("click",".index_cplh",function(e){
//		var dataId = $(this).attr("data_id");
//		window.location.href=baseUrl+"/cpxq/"+dataId;
//	});
//	
//	//经典案例跳转到案例详情
//	$(document).on("click",".span220",function(e){
//		var dataId = $(this).attr("data_id");
//		window.location.href=baseUrl+"/alxq/"+dataId;
//	});
//	
//	//资讯中心跳转到资讯详情
//	$(document).on("click",".span110",function(e){
//		var dataId = $(this).attr("data_id");
//		window.location.href=baseUrl+"/zxxq/"+dataId;
//	});